import { defineStore } from "pinia";
import {ref} from "vue";
export const useUserStore = defineStore("lyq-user",()=> {
  const token = ref("")
  const student_id = ref("")
  const userId = ref("")
  const avatar = ref("")
  const setToken=(newToken,newStudentId,newUserId,newAvatar)=>{
    token.value = newToken
    student_id.value = newStudentId
    userId.value = newUserId
    avatar.value = newAvatar
  }
  const setUserId=(newUserId)=>{
    userId.value = newUserId
    console.log(userId.value);
  }
  const removeToken=()=>{
    token.value = ""
    student_id.value = ""
    userId.value = ""
    avatar.value = ""
  }
  return {token,student_id,userId, avatar,setToken, removeToken,setUserId}
},
{
  persist: true
}
)
